<%--
  Created by IntelliJ IDEA.
  User: Stiofan
  Date: 2017/3/9
  Time: 14:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/common/tags.jsp" %>

<aos:html title="三方信息导入采集" base="http" lib="ext">
    <aos:body>
    </aos:body>
</aos:html>
<aos:onready>
    <aos:viewport layout="fit">
        <aos:panel layout="column" columnWidth="1" autoScroll="true">
            <aos:formpanel id="gtdrForm" layout="column" columnWidth="1">
                <aos:filefield id="gtdrwj" name="gtdrwj" buttonText="选择文件"
                               columnWidth="0.5" fieldLabel="国土采集文件"/>
                <aos:button id="btnGtdr" text="执行导入" columnWidth="0.1"
                            onclick="gtxxdr"/>
                <aos:button id="btnGtxz" text="模板下载" columnWidth="0.1"
                            onclick="gtmbxz"/>
            </aos:formpanel>
            <aos:formpanel id="fgdrForm" layout="column" columnWidth="1">
                <aos:filefield id="fgdrwj" name="fgdrwj" buttonText="选择文件"
                               columnWidth="0.5" fieldLabel="房管采集文件"/>
                <aos:button id="btnFgdr" text="执行导入" columnWidth="0.1"
                            onclick="fgxxdr"/>
                <aos:button id="btnFgxz" text="模板下载" columnWidth="0.1"
                            onclick="fgmbxz"/>
            </aos:formpanel>
            <aos:textareafield columnWidth="1" margin="5" disabled="true"
                               emptyText="第三方导入功能仅支持office 2010 以上数据文件格式，既：.xlsx，导入的模板文件需要由服务器上下载获得，系统导入时会针对模板文件进行格式校验，保证数据项准确。">
            </aos:textareafield>
        </aos:panel>
    </aos:viewport>
    <script type="text/javascript">
        function gtxxdr() {
            Ext.getCmp("gtdrForm").getForm().submit({
                url: "do.jhtml?juid=${juid}&router=dsfxxdrService.gtxxdr",
                method: "POST",
                waitMsg: "正在执行文件上传导入，请稍后...",
                failure: function (form, action) {
                    if (action.result.appcode === "suc") {
                        AOS.tip("国土信息文件导入成功!");
                    } else {
                        AOS.err("国土信息文件导入失败,请检查数据采集内容是否准确!");
                    }
                }
            });
        }

        function fgxxdr() {
            Ext.getCmp("fgdrForm").getForm().submit({
                url: 'do.jhtml?router=dsfxxdrService.fgxxdr&juid=${juid}',
                method: "POST",
                waitMsg: "正在执行文件上传导入，请稍后...",
                success: function (form, action) {
                    console.log("sdasadsafasfdsgdsgdsgds");
                    alert("9999");
                    Ext.Msg.alert('提示', '保存成功');
                },
                failure: function (form, action) {
                    if (action.result.appcode === "suc") {
                        AOS.tip("房管信息文件导入成功!");
                    } else {
                        AOS.err("房管信息文件导入失败,请检查数据采集内容是否准确!");
                    }
                }
            });

        }

        function gtmbxz() {
            AOS.ajax({
                url: "dsfxxdrService.gtmbxz",
                ok: function (data) {
                    if (data.appcode === "suc") {
                        window.location.href = "../static/drmb/" + data.fileName;
                    }
                }
            });

        }

        function fgmbxz() {
            AOS.ajax({
                url: "dsfxxdrService.fgmbxz",
                ok: function (data) {
                    if (data.appcode === "suc") {
                        window.location.href = "../static/drmb/" + data.fileName;
                    }
                }
            });
        }

    </script>
</aos:onready>
